<div class="row" id="topbar">
    <div class="container">
        <div class="col-xs-12">
            <div class="col-xs-6">
                <span><?php  echo Yii::t("view_partials_header", "Seclect Language"); ?></span>
<!--
                <select id="lang-select">
                    <option selected="selected" value="0">English</option>
                    <option value="1">Tiếng Việt</option>
                </select>
-->
                <?php echo CHtml::dropDownList('lang-select', yii::app()->languageSetter->lang(),  array('en' => 'English', 'vi' => 'Tiếng Việt'));?>
                <?php echo CHtml::hiddenField('hiddenChangeLangUrl' , $this->createUrl('Site/lang'), array('id' => 'hiddenChangeLangUrl')); ?>

                
            </div>
            <div class="col-xs-6 text-right">
                <!-- <span class="user-login">
                    <span>Welcome, </span>
                    <span class="username">Visitor</span>
                </span> -->
                <span class="user-cart">
                    <a href="<?php echo $this->createUrl('/checkout/cart'); ?>">
                        <i class="fa fa-shopping-cart"></i> <?php echo Yii::t("view_partials_header", "Your cart"); ?> <span id="cart-qty" title="<?php echo Yii::t('view_partials_header', 'Check your cart'); ?>">
                            <?php
                            if(isset(Yii::app()->session[SITE_ID . '_cart'])&&!empty(Yii::app()->session[SITE_ID . '_cart'])){
                                echo count(Yii::app()->session[SITE_ID . '_cart']);
                            }else{
                                echo '0';
                            }
                            ?>
                        </span>
                    </a>
                </span>
            </div>
        </div>
    </div>
</div>
<?php 
$controllerName = strtoupper(Yii::app()->controller->id);
$actionID = strtoupper(Yii::app()->controller->action->id);
$route = $controllerName.'/'.$actionID;
?>
<div id="menu" class="row">
    <div class="container">
        <div class="col-xs-12">
            <div class="row main-menu text-center">
                <div class="col-xs-5">
                    <div class="col-xs-4"><a class="font-bold menu-item <?php echo($route == 'SITE/INDEX' ? 'item-active' : '' ); ?>" href="<?php echo Yii::app()->homeUrl; ?>"><?php echo Yii::t("view_partials_header", "Home"); ?></a></div>
                    <div class="col-xs-4"><a class="font-bold menu-item <?php echo($route == 'NEWS/INDEX' ? 'item-active' : '' ); ?>" href="<?php echo $this->createUrl('/news'); ?>"><?php echo Yii::t("view_partials_header", "News"); ?></a></div>
                    <div class="col-xs-4"><a class="font-bold menu-item <?php echo($route == 'CATEGORIES/INDEX' ? 'item-active' : '' ); ?>" href="<?php echo $this->createUrl('/categories'); ?>"><?php echo Yii::t("view_partials_header", "Products"); ?></a></div>
                </div>
                <div class="col-xs-2 "><a id="logo" href="<?php echo Yii::app()->homeUrl; ?>"></a></div>
                <div class="col-xs-5">
                    <div class="col-xs-4"><a class="font-bold menu-item <?php echo($route == 'SERVICES' ? 'item-active' : '' ); ?>" href="<?php echo $this->createUrl('pages/Services'); ?>"><?php echo Yii::t("view_partials_header", "Services"); ?></a></div>
                    <div class="col-xs-4"><a class="font-bold menu-item <?php echo($route == 'PAGES/ABOUT' ? 'item-active' : '' ); ?>" href="<?php echo $this->createUrl('pages/about'); ?>"><?php echo Yii::t("view_partials_header", "About"); ?></a></div>
                    <div class="col-xs-4"><a class="font-bold  menu-item <?php echo($route == 'PAGES/CONTACT' ? 'item-active' : '' ); ?>" href="<?php echo $this->createUrl('pages/contact'); ?>"><?php echo Yii::t("view_partials_header", "Contact"); ?></a></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $('#cart-qty').poshytip({
        className: 'tip-yellowsimple',
        showOn: 'hover',
        alignTo: 'target',
        alignX: 'center',
        alignY: 'bottom',
        offsetX: 0,
        offsetY: 5,
        showTimeout: 100
    });

    $(document).ready(function() {
        $( "#lang-select" ).change(function() {
            var langCookie = "boxanh_lang=" + this.value;
            document.cookie = langCookie;

            var url = $("#hiddenChangeLangUrl").val();
            var lang = this.value;

            $.post(url, {'boxanh_lang' : lang}, function(data) {
              //alert(data);
              location.reload();
            });
        });                 
    });


</script>